<template>
  <div style="width: 100%">
    <a-card class="card" :bordered="false" style="padding: 20px">
      <div class="table-page-search-wrapper">
        <a-form layout="inline" :form="form">
          <a-row :gutter="48">
            <a-col :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
              <a-form-item label="开始时间">
                <a-date-picker v-decorator="[
                'startDate',
                {
                  rules: [{ required: true, message: '请选择开始时间!' }]
                }
              ]" format="YYYY-MM-DD" placeholder="请选择..." />
              </a-form-item>
            </a-col>
            <a-col :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
              <a-form-item label="结束时间">
                <a-date-picker v-decorator="[
                'endDate',
                {
                  rules: [{ required: true, message: '请选择结束时间!' }]
                }
              ]" format="YYYY-MM-DD" placeholder="请选择..." />
              </a-form-item>
            </a-col>
            <a-col :sm="{span:24}" :xl="{span:24}" style="text-align:center">
              <a-button type="primary" @click="handleSubmit">保存</a-button>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: this.$form.createForm(this)
    }
  },
  created() {
    this.$api.system.info().then(res => {
      this.$nextTick(() => {
        this.form.setFieldsValue({
          startDate:res.data.lwxgsjStart,
          endDate:res.data.lwxgsjEnd
        })
      })
    })
  },
  methods: {
    //保存时间
    handleSubmit() {
      this.form.validateFields(
        (err, values) => {
          if (!err) {
            let params = {
              startDate:values.startDate.format("YYYY-MM-DD HH:mm:ss"),
              endDate:values.endDate.format("YYYY-MM-DD HH:mm:ss")
            }
            this.$api.degree.paperSetEditTime(params).then((res) => {
              this.$message.success('设置成功');
            })
          }
        },
      );
    }
  }
}

</script>
<style lang="less" scoped>
.card {
  margin-bottom: 20px;
}

</style>
